Skip to content
This repository was archived by the owner on Jan 14, 2024. It is now read-only.

WM4_Gary_Rogers_JS2_Week_1#106

Open
GryRgrs wants to merge 5 commits into
CodeYourFuture:mainfrom
GryRgrs:main
Open

WM4_Gary_Rogers_JS2_Week_1#106
GryRgrs wants to merge 5 commits into
CodeYourFuture:mainfrom
GryRgrs:main

Conversation

@GryRgrs
Copy link
Copy Markdown

@GryRgrs GryRgrs commented Sep 16, 2022

Volunteers: Are you marking this coursework? You can find a guide on how to mark this coursework in HOW_TO_MARK.md in the root of this repository

Your Details

  • Your Name:
  • Your City:
  • Your Slack Name:

Homework Details

  • Module:
  • Week:

Notes

  • What did you find easy?

  • What did you find hard?

  • What do you still not understand?

  • Any other notes?


let myCountry = "UnitedKingdom";
let myCapitalCity; // complete the code
let myCapitalCity = "London"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


// write code here

let topPlayers = ["Michael Jordan", "Scottie Pippen", "Dennis Rodman"];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should not copy the code but use the dot notation or bracket notation to retrieve values from the object.
Please check this:
https://codeburst.io/javascript-quickie-dot-notation-vs-bracket-notation-333641c0f781
https://syllabus.codeyourfuture.io/js-core-2/week-1/lesson#objects

population: 9750000,
}
};
capitalCities.UnitedKingdom = 8980000;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The part related to: "Change the value of UnitedKingdom's capital city population to 8980000." You did well :)

You need to do the same way the other part of the exercise:
- Add the property for population to China's capital city and set the value to 21500000.
- Add the country "Peru" to capitalCities object.
- Add a name of "Lima" to Peru's capital city.
- Add a population of 9750000 to Peru's capital city.

Please check this: https://bobbyhadz.com/blog/javascript-add-key-value-pair-to-object


// write code here

let student = {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use bracket notation here - the exercise needs to be done dynamically, not hard coded.

};

console.log(myPet.getName());
console.log(myPet.getName()); //has attempted to create a function element where the property should be//
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check what is missing in the function.
This is quite interesting post about it: https://stackoverflow.com/questions/17337064/does-every-javascript-function-have-to-return-a-value

};

sayHelloToUser(user);
sayHelloToUser(user); //Hello in the console log is undefined, as well as 'firstName' not identified as the object 'name'//
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check one more time what parameters have the user object.

};

console.log(car["colour"]);
console.log(car["colour"]); //"colour" is not defined as an object anywhere in the variable statement//
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the CYF lesson about objects: https://syllabus.codeyourfuture.io/js-core-2/week-1/lesson#objects

let student = {
// write code here
}
name: "Daniel",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please think about the object's methods as functions because basically, they are functions.
You need to finish this exercise in a dynamic way.

Please check this: https://syllabus.codeyourfuture.io/js-core-1/week-1/lesson#functions

}
let currencyCodes = {};
countryCurrencyCodes.forEach((element) =>
currencyCodes[0] = element[1]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is a small thing to fix the end of the entire exercise will be done perfectly! 👍
Please think over where You can use bracket notation in the line 23.

Copy link
Copy Markdown

@Pat-On Pat-On left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are close to understanding key topics from these exercises. Please check the materials that I attached in the comments :)

From the mandatory exercise, You need to change one thing to have completely done exercise 2. Great 👍

Please finish mandatory 2 and 3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants